Communications 107

After the reader presses the button button, I'll pop up a window to say hello.

Discussion

This seventh "hello" program uses window.open() and document.write() to create a new popup window. The window.open() call creates a new window which is written to by a series of document.write()s. When the writes complete, a document.close(), instructs the window to stop loading new information. The quit button works by sending a self.close() message. The button's "self" in this case refers to the popup window. Do not confuse document.close() which finishes creating a document's contents, with window.close(), which closes a physical window.

Creating a popup window

popup = window.open("","popDialog","scrollbars=no,height=100,width=300")
parent.JChello.document.write(s1+s2+msg+s3)
parent.JChello.document.close()
Copyright ©1998 by Charles River Media, All Rights Reserved